<template>
  <div>
    <div class="value">{{ name }}</div>
    <div class="value">{{ comName }}</div>
    <button @click="add">加一</button>
    <Son sonAge="33" />
    <Son2 @changeSonName="test" />
  </div>
</template>

<script>
import Son from "../components/Son";
import Son2 from "../components/Son2";
export default {
  name: "Home",
  components: { Son2, Son },
  data() {
    return {
      name: 0,
    };
  },
  methods: {
    add() {
      this.name++;
    },
    test(name) {
      console.log(name);
    },
  },
  computed: {
    comName() {
      return this.name + 10;
    },
  },
  watch: {
    // 监听
    name(value, oldValue) {
      console.log("你傻逼变了");
    },
  },
  beforeCreate() {},
  created() {},
  beforeUpdate() {},
  updated() {},
  beforeMount() {},
  mounted() {},
  beforeDestroy() {},
  destroyed() {},
};
</script>
